var fs = require('fs');

var data = 'hello node.js';

var w = fs.createWriteStream('a.txt');

w.write(data, 'utf8');

w.end();

w.on('finish', function() {
	console.log('write end');
});

w.on('error', function(err) {
	console.log(err.stack);
});

console.log('program end');
